//
//  ViewController.m
//  UI07_UIITextView
//
//  Created by aaaaaa on 16/6/14.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()<UITextViewDelegate>

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(100, 100, 200, 50)];
    
    textView.backgroundColor = [UIColor orangeColor];
    //是否允许用户编辑内容 默认允许
    textView.editable = YES;
    
    //当文本超过视图的时候是否允许滑动
    textView.scrollEnabled = YES;
    
    textView.font = [UIFont systemFontOfSize:20];
    
    //设置return键的类型
    textView.returnKeyType = UIReturnKeyNext;
    
    //设置键盘类型
    textView.keyboardType = UIKeyboardTypeDefault;
    
    //设置文本显示位置 默认是左
    textView.textAlignment = NSTextAlignmentLeft;
    
    textView.textColor = [UIColor blackColor];
    
    textView.text = @"考虑加多少个";
    
    textView.layer.cornerRadius = 5;
    textView.layer.borderWidth = 2;
    
    textView.delegate = self;
    
    [self.view addSubview:textView];
    [textView release];

}

//将要开始编辑
- (BOOL)textViewShouldBeginEditing:(UITextView *)textView{
    NSLog(@"%d, %s", __LINE__, __FUNCTION__);
    return YES;
}

//将要结束编辑
- (BOOL)textViewShouldEndEditing:(UITextView *)textView{
    NSLog(@"%d, %s", __LINE__, __FUNCTION__);
    return YES;
}

//开始编辑
- (void)textViewDidBeginEditing:(UITextView *)textView{
    NSLog(@"%d, %s", __LINE__, __FUNCTION__);
}

//结束编辑
- (void)textViewDidEndEditing:(UITextView *)textView{
    NSLog(@"%d, %s", __LINE__, __FUNCTION__);
}





- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
